import { createApp } from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
import Antd from 'ant-design-vue';
import 'ant-design-vue/dist/reset.css';
import { BaiduMap } from 'vue-baidu-map-3x';
import i18n from './i18n/i18n';

const app = createApp(App);

app.use(store);
app.use(router);
app.use(Antd);
app.use(i18n);
app.use(BaiduMap, {
    ak: '2PLsJxjb9mdlvuuBVx3N4gPKyZDgt8rK',
});
app.mount('#app');

let lastScrollTop = 0;
const navbar = document.getElementById('navbar');

window.addEventListener('scroll', () => {
    const currentScroll = window.pageYOffset || document.documentElement.scrollTop;
    if (currentScroll > lastScrollTop) {
        navbar.style.top = '-100px'; // 隐藏导航栏
    } else {
        navbar.style.top = '0'; // 显示导航栏
    }
    lastScrollTop = currentScroll <= 0 ? 0 : currentScroll;
});
